<!DOCTYPE html>
<html>
<head>
    <title>Function Example 7</title>
    <script type="text/javascript">
        function doAdd() {
            if(arguments.length == 1) {
                alert(arguments[0] + 10);
            } else if (arguments.length == 2) {
                alert(arguments[0] + arguments[1]);
            }
        }
        
        doAdd(10);        //20
        doAdd(30, 20);    //50

    </script>
</head>
<body>

</body>
</html>